<%@page import="java.sql.ResultSet"%>
<%@page import="database.DBConnector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
            String password = "";
            String login = request.getParameter("login");
            String pw = request.getParameter("password");
            DBConnector dbc = DBConnector.getDBC();
            ResultSet rs = dbc.doQuery("SELECT password FROM customers WHERE TelephoneNumber='" + login + "';");
            while (rs.next()) {
                password = rs.getString(1);
            }
            if (password.equals(pw)) {
                session.setAttribute("login", "true");
                response.sendRedirect("../Frontend/index.jsp");
            } else {
                session.removeAttribute("login");
                response.sendRedirect("../Frontend/newCustomer.jsp");
            }
%>
